package cn.biplam.front.html;

import cn.biplam.common.wrapper.ErrorMessage;
import cn.biplam.front.html.base.HtmlWindow;

/**
 * Html FieldSet Legend
 * @author XiaoRuxing 2009-7-20下午05:51:34
 * @version 1.0
 */
public class HtmlFieldSetLegend extends HtmlWindow{

	private String text;

	public HtmlFieldSetLegend(){}

	/**
	 * 构造方法
	 * @param ID 页面ID
	 */
	public HtmlFieldSetLegend(String ID){
		super(ID);
	}

	/**
	 * 构造方法
	 * @param ID    页面ID
	 * @param cssID cssID
	 */
	public HtmlFieldSetLegend(String ID,String cssID){
		super(ID,cssID);
	}

	/**
	 * 
	 * @param ID         页面ID
	 * @param cssID      cssID
	 * @param legendText 标题文字
	 */
	public HtmlFieldSetLegend(String ID,String cssID,String legendText){
		super(ID,cssID);
		this.text=legendText;
	}

	@Override
	protected void _getContent(StringBuilder sb) throws ErrorMessage {
	}

	/**
	 * 获取对象的Html形式
	 * @param sb
	 * @throws ErrorMessage
	 */
	@Override
	public void getHtml(StringBuilder sb) throws ErrorMessage {
		sb.append("<legend ");
		super.writeTagSetting(sb);
		sb.append(">\n");
		sb.append(text);
		this.getContent(sb);
		sb.append("</legend>\n");
	}

	/**
	 * 复制对象
	 * @return 创建的新对象实例
	 * @throws ErrorMessage
	 */
	@Override
	public HtmlWindow copy() throws ErrorMessage {
		HtmlFieldSetLegend legend = new HtmlFieldSetLegend(this.getID(),this.getCssID());
		legend.text=this.text;
		super._copy(legend);
		return legend;
	}
}
